package com.zhz.common.enums;


import com.zhz.common.tool.mybatisplus.base.core.enums.EnumValueResolver;
import com.zhz.common.tool.mybatisplus.base.core.enums.IEnum;
import lombok.AllArgsConstructor;

/**
 * 错误异常码
 * @author zhouhengzhe
 */
@AllArgsConstructor
public enum ErrorCodeEnum  implements IEnum<Integer>, EnumValueResolver<ErrorCodeEnum, Integer> {
    PARAMETER_VALIDATION_FAILED(10000, "参数校验失败"),
    DB_OPERATION_EXCEPTION(10001, "数据库操作异常"),
    REQUEST_INTERFACE_TIMEOUT(10002, "接口请求超时"),
    REQUEST_INTERFACE_ERROR(10004, "接口请求异常"),
    REPEATED_REQUESTS(10003, "重复/频繁请求");

    private final Integer code;
    private final String desc;

    /**
     * 获取编码
     *
     * @return
     */
    @Override
    public Integer getCode() {
        return this.code;
    }

    /**
     * 获取描述
     *
     * @return
     */
    @Override
    public String getMessage() {
        return this.desc;
    }
}
